Here is a list of common arguments:
Here is a list of common arguments:
In order to understand the customer purchase behavior against various products of different categories, the retail company “ABC Private Limited”, in the United Kingdom, shared purchase summary of various customers for selected high volume products from the last month. The data contain the following variables.
User_ID: User ID
Product_ID: Product ID
Gender: Sex of User
Age: Age in bins
Occupation: Occupation (Masked)
City_Category: Category of the City (A,B,C)
Stay_In_Current_City_Years: Number of years stay in current city
Marital_Status: Marital Status
Product_Category_1: Product Category (Masked)
Product_Category_2: Product may belong to other category also (Masked)
Product_Category_3: Product may belong to other category also (Masked)
Purchase: Purchase Amount
Rows: 550,068
Columns: 12
$ User_ID <int> 1000001, 1000001, 1000001, 1000001, 1000002…
$ Product_ID <chr> "P00069042", "P00248942", "P00087842", "P00…
$ Gender <chr> "F", "F", "F", "F", "M", "M", "M", "M", "M"…
$ Age <chr> "0-17", "0-17", "0-17", "0-17", "55+", "26-…
$ Occupation <int> 10, 10, 10, 10, 16, 15, 7, 7, 7, 20, 20, 20…
$ City_Category <chr> "A", "A", "A", "A", "C", "A", "B", "B", "B"…
$ Stay_In_Current_City_Years <chr> "2", "2", "2", "2", "4+", "3", "2", "2", "2…
$ Marital_Status <int> 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0…
$ Product_Category_1 <int> 3, 1, 12, 12, 8, 1, 1, 1, 1, 8, 5, 8, 8, 1,…
$ Product_Category_2 <int> NA, 6, NA, 14, NA, 2, 8, 15, 16, NA, 11, NA…
$ Product_Category_3 <int> NA, 14, NA, NA, NA, NA, 17, NA, NA, NA, NA,…
$ Purchase <int> 8370, 15200, 1422, 1057, 7969, 15227, 19215…
---
title: "Basic Graphical Displays"
output:
flexdashboard::flex_dashboard:
theme:
version: 4
bootswatch: default
navbar-bg: "purpleple"
orientation: columns
vertical_layout: fill
source_code: embed
---
```{r setup, include=FALSE}
library(flexdashboard)
library (tidyverse)
library(DT)
library(plotly)
Friday <- read.csv("./Black_Friday.csv")
```
Brief Overview 1
===
Column {data-width=450}
---
Column {data-width=650}
-----------------------------------------------------------------------
### Graphical Displays
- Categorical Data
- Bar Chart
- Pie Chart
- Quantitative Data
- Histogram
- Boxplot
- Scatterplot
- Line
### Common Arguments
Here is a list of common arguments:
- col: a vector of colors
- main: title for the plot
- xlim or ylim: limits for the x or y axis
- xlab or ylab: a label for the x axis
- font: font used for text, 1=plain; 2=bold; 3=italic, 4=bold italic
- font.axis: font used for axis
- cex.axis: font size for x and y axes
- font.lab: font for x and y labels
- cex.lab: font size for x and y labels
Brief Overview 2 {data-orientation=rows}
===
Row {data-height=100}
---
Row {data-height=900}
---
### Graphical Displays
- Categorical Data
- Bar Chart
- Pie Chart
- Quantitative Data
- Histogram
- Boxplot
- Scatterplot
- Line
### Common Arguments
Here is a list of common arguments:
- col: a vector of colors
- main: title for the plot
- xlim or ylim: limits for the x or y axis
- xlab or ylab: a label for the x axis
- font: font used for text, 1=plain; 2=bold; 3=italic, 4=bold italic
- font.axis: font used for axis
- cex.axis: font size for x and y axes
- font.lab: font for x and y labels
- cex.lab: font size for x and y labels
Data
---
Column {data-width=550}
---
### <b><font size= 4><span Style ="color: blue">First 500 Observations </span></font></b>
```{r show_table}
datatable(Friday[1:500,], rownames = FALSE, colnames = c("User ID", "Product ID","Gender", "Age", "Occupation", "City Category", "Stay In Current City Years","Marital Status", "Product Category 1", "Product Category 2", "Product Category 3"),options = list(pageLength = 20))
```
Column {data-width=350}
---
### <font size = 4><span Style = "color:red">Description< /span></font>
In order to understand the customer purchase behavior against various products of different categories, the retail company "ABC Private Limited", in the United Kingdom, shared purchase summary of various customers for selected high volume products from the last month. The data contain the following variables.
- User_ID: User ID
- Product_ID: Product ID
- Gender: Sex of User
- Age: Age in bins
- Occupation: Occupation (Masked)
- City_Category: Category of the City (A,B,C)
- Stay_In_Current_City_Years: Number of years stay in current city
- Marital_Status: Marital Status
- Product_Category_1: Product Category (Masked)
- Product_Category_2: Product may belong to other category also (Masked)
- Product_Category_3: Product may belong to other category also (Masked)
- Purchase: Purchase Amount
```{r}
glimpse(Friday)
```
### **Vertical Bar Chart**
```{r bar}
par(mgp=c(2,1,0))
par(mar=c(5,7,4,2))
barplot(table(Friday$Age), col = "lightblue", main = "Distribution of Purchases by Customer's Age", ylab = "Number of Purchases",
xlab = "Age Group")
```
### **Horizontal Bar Chart**
```{r bar1}
par(mgp=c(2,1,0))
par(mar=c(5,7,4,2))
Friday$Age <- factor(Friday$Age)
ggplot(Friday, aes(x = Age)) +
geom_bar(stat = "count") +
coord_flip() +
labs(title = "Distribution of Purchases by Customer's Age",
x = "Age Groups",
y = "Number of Purchases") -> bar1
ggplotly(bar1)
```